<script setup>
import { reactive, ref, onMounted } from 'vue'
// const obj = ref({ name: '张三' })
const tableData = ref([
  {
    date: '2016-05-03',
    name: 'Tom1',
    state: 'California',
    city: 'Los Angeles',
    address: 'No. 189, Grove St, Los Angeles',
    zip: 'CA 90036',
    tag: 'Home',
  },
  {
    date: '2016-05-02',
    name: 'Tom2',
    state: 'California',
    city: 'Los Angeles',
    address: 'No. 189, Grove St, Los Angeles',
    zip: 'CA 90036',
    tag: 'Office',
  }
])


const handleClick = () => {
  tableData.value[1].name = ['刘老六']
  console.log('tableData', tableData)
}

// onMounted(() => {
//   handleClick()
// })
</script>

<template>
  <div>
    <el-button type="primary">新增</el-button>
    <el-button type="success">导出</el-button>
  </div>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column fixed="left" prop="date" label="Date" width="150" />
    <el-table-column fixed="left" prop="name" label="Name" width="120" />
    <el-table-column prop="state" label="State" width="120" />
    <el-table-column prop="city" label="City" width="200" />
    <el-table-column prop="address" label="Address" min-width="600" />
    <el-table-column prop="zip" label="Zip" width="120" />
    <el-table-column fixed="right" label="Operations" width="180">
      <template #default>
        <el-button link type="primary" size="small" @click="handleClick">
          详情
        </el-button>
        <el-button link type="primary" size="small">编辑</el-button>
        <el-button link type="primary" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<style scoped>
</style>
